// import owhat from "./owhat"
// import taoba from "./taoba"

// export function getFundDetail(type, id) {
//   // debugger;
//   switch (type) {
//     case "owhat": return owhat.getFundDetail(id)
//     case "taoba": return taoba.getFundDetail(id)
//     default: throw new Error("unkown fund type: " + type)
//   }
// }

// export function getFundURL(type, id) {
//   switch (type) {
//     case "owhat": return `https://m.owhat.cn/shop/shopdetail.html?id=${id}`
//     case "taoba": return `https://www.taoba.club/#/pages/idols/detail?id=${id}`
//     default: throw new Error("unkown fund type: " + type)
//   }
// }


export function getFundDetail(type, id) {
  return fetch(`/fund/${type}/${id}`).then(res => res.json())
}

export function getFundURL(type, id) {
  if (id==0) return;
  switch (type) {
    case "owhat": return `https://m.owhat.cn/shop/shopdetail.html?id=${id}`
    case "taoba": return `https://www.taoba.club/#/pages/idols/detail?id=${id}`
    default: throw new Error("unkown fund type: " + type)
  }
}

export default {
  getFundURL,
  getFundDetail,
}
